<template>
  <home/>

  <h2>App:{{ $store.state.counter }}</h2>
  <button @click="increment">+1</button>
  <button @click="decrement">-1</button>
</template>

<script>
import Home from './pages/06_mutation的细节补充.vue'

import {onBeforeMount,onMounted,onBeforeUpdate,onupdated,onBeforeUnMount,onUnmounted} from 'vue'
export default {
  name: "App",
  components: {
    Home
  },
  methods: {
    increment() {
      this.$store.commit("increment")
    },
    decrement() {
      this.$store.commit("decrement")
    },
  },
  beforeCreate(){
    console.log('vue2feforeCreate')
  },
  created(){
    console.log('vue2created')
  },
  beforeMount(){
   console.log('vue2模板渲染之前')
  },
  setup(){
    console.log('vue3相当于，beforeCreate+created')

    onBeforeMount(()=>{
      console.log('vue3BeforMount')
    })
    onBeforeUpdate(() => {
      console.log('vue3相当于vue2BeforeUpdate')
    })

  }
};
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
